package com.ecoolex.ying.space.ws;

import java.util.Date;
import java.util.List;

import com.ecoolex.ying.space.core.manager.*;
import com.ecoolex.ying.space.core.service.UserWorksSearchService;
import org.apache.dubbo.config.annotation.Service;
import org.springframework.beans.factory.annotation.Autowired;

import com.ecoolex.framework.common.exception.BizException;
import com.ecoolex.framework.common.pojo.Page;
import com.ecoolex.framework.common.pojo.Pagination;
import com.ecoolex.framework.common.pojo.Sorting;
import com.ecoolex.ying.space.entity.UserWorks;
import com.ecoolex.ying.space.entity.UserWorksImages;
import com.ecoolex.ying.space.entity.UserWorksOpus;
import com.ecoolex.ying.space.entity.UserWorksOpusItems;
import com.ecoolex.ying.space.entity.UserWorksShopping;
import com.ecoolex.ying.space.entity.UserWorksStatistical;
import com.ecoolex.ying.space.entity.UserWorksVideo;
import com.ecoolex.ying.space.pojo.AddUserWorksDTO;
import com.ecoolex.ying.space.pojo.AddUserWorksImageDTO;
import com.ecoolex.ying.space.pojo.AddUserWorksOpusDTO;
import com.ecoolex.ying.space.pojo.AddUserWorksVideoDTO;
import com.ecoolex.ying.space.pojo.EditUserWorksImageDTO;
import com.ecoolex.ying.space.pojo.EditUserWorksOpusDTO;
import com.ecoolex.ying.space.pojo.EditUserWorksVideoDTO;
import com.ecoolex.ying.space.pojo.QueryShopWindowGoodsDTO;


@Service
public class UserWorksServiceImpl implements UserWorksService {

    @Autowired
    private UserWorksManager userWorksManager;

    @Override
    public UserWorks addUserWorksImages(AddUserWorksImageDTO addUserWorksImageDTO, Integer userId, String createUser) {
        return userWorksManager.addUserWorksImages(addUserWorksImageDTO, userId, createUser);
    }

    @Override
    public UserWorks addUserWorksVideo(AddUserWorksVideoDTO addUserWorksVideoDTO, Integer userId, String createUser) {
        return userWorksManager.addUserWorksVideo(addUserWorksVideoDTO, userId, createUser);
    }

    @Override
    public UserWorks addUserWorksOpus(AddUserWorksDTO addUserWorksDTO, AddUserWorksOpusDTO addUserWorksOpusDTO, Integer userId, String createUser) {
        return userWorksManager.addUserWorksOpus(addUserWorksDTO, addUserWorksOpusDTO, userId, createUser);
    }

    @Override
    public boolean releaseUserWorks(UserWorks record, String updateUser) throws BizException {
        return userWorksManager.releaseUserWorks(record, updateUser);
    }

    @Override
    public UserWorks editUserWorksImages(UserWorks userWorks, EditUserWorksImageDTO editUserWorksImageDTO, Integer userId, String updateUser) throws BizException {
        return userWorksManager.editUserWorksImages(userWorks, editUserWorksImageDTO, userId, updateUser);
    }

    @Override
    public UserWorks editUserWorksVideo(UserWorks userWorks, EditUserWorksVideoDTO editUserWorksVideoDTO, Integer userId, String updateUser) throws BizException {
        return userWorksManager.editUserWorksVideo(userWorks, editUserWorksVideoDTO, userId, updateUser);
    }

    @Override
    public UserWorks editUserWorksOpus(UserWorks userWorks, EditUserWorksOpusDTO editUserWorksOpusDTO, Integer userId, String updateUser) throws BizException {
        return userWorksManager.editUserWorksOpus(userWorks, editUserWorksOpusDTO, userId, updateUser);
    }

    @Override
    public void deleteUserWorksImages(UserWorks userWorks, String updateUser) throws BizException {
        userWorksManager.deleteUserWorksImages(userWorks, updateUser);
    }

    @Override
    public void deleteUserWorksVideo(UserWorks userWorks, String updateUser) throws BizException {
        userWorksManager.deleteUserWorksVideo(userWorks, updateUser);
    }

    @Override
    public void deleteUserWorksOpus(UserWorks userWorks, String updateUser) throws BizException {
        userWorksManager.deleteUserWorksOpus(userWorks, updateUser);
    }

    @Override
    public UserWorks getUserWorksById(Integer worksId) {
        return userWorksManager.getById(worksId);
    }

    @Override
    public Pagination<UserWorks> queryForH5(String title, Integer worksType, Date now, Sorting[] sorts, Page page) {
        return userWorksManager.queryForH5(title, worksType, now, sorts, page);
    }

    @Override
    public Pagination<UserWorks> queryWatchForH5(Integer userId, String title, Integer worksType, Date now, Sorting[] sorts, Page page) {
        return userWorksManager.queryWatchForH5(userId, title, worksType, now, sorts, page);
    }

    @Override
    public Pagination<UserWorks> queryMyUserWorksForH5(String title, Integer userId, Sorting[] sorts, Page page) {
        return userWorksManager.queryMyUserWorksForH5(title, userId, sorts, page);
    }

    @Override
    public Pagination<UserWorks> queryMyUserWorksOpusForH5(String title, Integer worksType, Integer userId, Sorting[] sorts, Page page) {
        return userWorksManager.queryMyUserWorksOpusForH5(title, worksType, userId, sorts, page);
    }

    @Override
    public long queryMyUserWorksCountOpusForH5(Integer worksType, Integer userId) {
        return userWorksManager.queryMyUserWorksCountOpusForH5(userId, worksType);
    }

    @Override
    public long queryMyUserWorksCountForH5(Integer userId) {
        return userWorksManager.queryMyUserWorksCountForH5(userId);
    }

    @Override
    public Pagination<UserWorks> queryOtherUserWorksOpusForH5(String title, Integer userId, Sorting[] sorts, Page page) {
        return userWorksManager.queryOtherUserWorksOpusForH5(title, userId, sorts, page);
    }

    @Override
    public Pagination<UserWorks> queryOtherUserWorksForH5(String title, Integer userId, Sorting[] sorts, Page page) {
        return userWorksManager.queryOtherUserWorksForH5(title, userId, sorts, page);
    }

    @Override
    public long queryOtherUserWorksOpusCountForH5(Integer userId) {
        return userWorksManager.queryOtherUserWorksOpusCountForH5(userId);
    }

    @Override
    public long queryOtherUserWorksCountForH5(Integer userId) {
        return userWorksManager.queryOtherUserWorksCountForH5(userId);
    }

    @Autowired
    private UserWorksImagesManager userWorksImagesManager;

    @Override
    public UserWorksImages getUserWorksImagesByWorksId(Integer worksId) {
        return userWorksImagesManager.getByWorksId(worksId);
    }

    @Autowired
    private UserWorksVideoManager userWorksVideoManager;

    @Override
    public UserWorksVideo getUserWorksVideoByWorksId(Integer worksId) {
        return userWorksVideoManager.getByWorksId(worksId);
    }

    @Autowired
    private UserWorksOpusManager userWorksOpusManager;

    @Override
    public UserWorksOpus getUserWorksOpusByWorksId(Integer worksId) {
        return userWorksOpusManager.getByWorksId(worksId);
    }

    @Autowired
    private UserWorksOpusItemsManager userWorksOpusItemsManager;

    @Override
    public List<UserWorksOpusItems> getUserWorksOpusItemsByWorksId(Integer worksId) {
        return userWorksOpusItemsManager.getByWorksId(worksId);
    }

    @Autowired
    private UserWorksShoppingManager userWorksShoppingManager;

    @Override
    public List<UserWorksShopping> getUserWorksShoppingByStorageId(String storageId) {
        return userWorksShoppingManager.queryByStorageId(storageId);
    }

    @Override
    public UserWorksShopping getUserWorksShoppingById(Integer id) {
        return userWorksShoppingManager.getById(id);
    }

    @Override
    public Pagination<UserWorks> queryUserWorksList(String title, Integer auditStatus, Sorting[] sorts, Page page) {
        return userWorksManager.queryUserWorksList(title, auditStatus, sorts, page);
    }

    @Override
    public Pagination<UserWorks> queryUserWorksOpusList(String title, Integer auditStatus, Sorting[] sorts, Page page) {
        return userWorksManager.queryUserWorksOpusList(title, auditStatus, sorts, page);
    }

    @Autowired
    private UserWorksStatisticalManager userWorksStatisticalManager;

    @Override
    public UserWorksStatistical getUserWorksStatisticalByWorksId(Integer worksId) {
        return userWorksStatisticalManager.getByWorksId(worksId);
    }

    @Override
    public boolean praseUserWorks(Integer worksId, String updateUser) throws BizException {
        return userWorksStatisticalManager.praseCount(worksId, updateUser);
    }

    @Override
    public UserWorks getUserWorksByIdForH5(Integer worksId) {
        return userWorksManager.getByIdForH5(worksId);
    }

    @Override
    public UserWorks getByIdAndUserId(Integer worksId, Integer userId) {
        return userWorksManager.getByIdAndUserId(worksId, userId);
    }

    @Override
    public Pagination<UserWorks> queryMyShopWindowUserWorks(String title, Integer worksType, Integer userId, Sorting[] sorts, Page page) {
        return userWorksManager.queryMyShopWindowUserWorks(title, worksType, userId, sorts, page);
    }

    @Override
    public Pagination<QueryShopWindowGoodsDTO> queryShopWindowGoodsByUserId(Integer userId, Sorting[] sorts, Page page) {
        return userWorksShoppingManager.queryShopWindowGoodsByUserId(userId, sorts, page);
    }

    @Override
    public Pagination<QueryShopWindowGoodsDTO> queryShopWindowGoodsByWorksId(Integer worksId, Sorting[] sorts, Page page) {
        return userWorksShoppingManager.queryShopWindowGoodsByWorksId(worksId, sorts, page);
    }

    @Override
    public long queryShopWindowGoodsCountByUserId(Integer userId) {
        return userWorksShoppingManager.queryShopWindowGoodsCountByUserId(userId);
    }

    @Autowired
    private UserWorksSearchService userWorksSearchService;

    @Override
    public Pagination<UserWorks> queryBySearchKeyword(String keyword, Page page) {
        return userWorksSearchService.searchByKeyword(keyword, page);
    }

}
